#pragma once
#include <stdio.h>
#include <windows.h>
#include <string>
#include "common.h"
using namespace std;

class Number
{
private:
	__int64 number;
	int resolution;

public:
	Number() : number(0), resolution(0) {};
	Number(int i) : number(__int64(i)), resolution(0) {};
	Number(const Number &i) : number(i.number), resolution(i.resolution) {};
	Number(long i) : number(__int64(i)), resolution(0) {};
	Number(DWORD i) : number(__int64(i)), resolution(0) {};
	Number(__int64 i) : number(__int64(i)), resolution(0) {};
	Number(char *i)
	{
		resolution = 0;
		if(strchr(i, '.') > i) {
			resolution = -(int)(strlen(i) - (strchr(i, '.') - i + 1));
		}

		number = atoi(i);
		for(int c=0; c<-resolution; c++) {
			number *= 10;
		}

		if(resolution) {
			number += atoi(strchr(i, '.')+1);
		}
	}
	Number(double i)
	{
		resolution = 0;
		char buf[100];
		sprintf_s<sizeof(buf)>(buf, "%lf", i);
		*this = Number(buf);
	}

	__int64 getNumber() {return number;};

	const string toString();

	const Number operator + (const Number &i) const;
	const Number operator - (const Number &i) const;
	const Number operator * (const Number &i) const;
	const Number operator / (const Number &i) const;
	const Number operator % (const Number &i) const;
	bool operator == (const Number &i) const;
	bool operator != (const Number &i) const;
	bool operator < (const Number &i) const;
	bool operator <= (const Number &i) const;
	bool operator > (const Number &i) const;
	bool operator >= (const Number &i) const;
	Number& operator = (const Number &i);
};